#include "events.h"
#include <unistd.h>

int size_event(AbstractEvent &event)
{
    int event_length;
    switch(event.type){
        case network:       event_length = sizeof(NetworkEvent);    break;
        case msg:           event_length = sizeof(MsgEvent);        break;
        case file_answer:   event_length = sizeof(FileAnswerEvent); break;
        case file_ask:      event_length = sizeof(FileAskEvent);    break;
        default:            event_length = sizeof(AbstractEvent);
    }
    return event_length;
}

AbstractEvent::AbstractEvent()
{
    msg_type=1;
    src_pid=getpid();
}

MsgEvent::MsgEvent()
{
    type=msg;
}

NetworkEvent::NetworkEvent()
{
    type=network;
}

FileAnswerEvent::FileAnswerEvent()
{
    type=file_answer;
}


FileAskEvent::FileAskEvent()
{
    type=file_ask;
}
